﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageBus.aspx.cs" MasterPageFile="~/Site.master" Title="Quản lý xe" Inherits="View_ManageBusRides" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">

            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("tbnExport") >= 0)
                    args.set_enableAjax(false);
            }
            //enter search
            function OnKeyPress(sender, eventArgs) {
                var c = eventArgs.get_keyCode();
                if (c == 13) {
                    var stringSearch = $("#<%= txtKeyWord.ClientID%>").val();
                    $("#<%= hdfSearchString.ClientID %>").val(stringSearch);
                    $("#<%=btnSearch.ClientID %>").click();
                    eventArgs.set_cancel(true);
                }
            }

            function messsage(mes) {
                alert(mes);
                return false;
            }


        </script>
    </telerik:RadScriptBlock>
    <link href="../Style/StyleCommon.css" rel="stylesheet" type="text/css" />
    <link href="../Style/StyleCommon.css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="../Scripts/Common.js"> </script>
    <div class="tabHeader">
        <span class="iconHomeBox">
            <img src="../Content/system/busicon.png" style="width: 35px; height: 35px; position: absolute" title="Quản lý xe" />
            <div class="tabHeaderText" style="padding-top: 5px; padding-left: 40px;">
                <asp:Label ID="Label1" runat="server" Text="Quản lý xe" />
            </div>
        </span>
    </div>
    <div id="tab1" class="tabContent tabDetailContent">
         
        <telerik:RadAjaxPanel ID="rapBusRides" runat="server" LoadingPanelID="loadingPanel"
            HorizontalAlign="NotSet">
            <asp:HiddenField runat="server" ID="hdfSearchString" />
            <div id="message">
            </div>
            <table style="width: 100%">
                <tr style="text-align: left">
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <telerik:RadTextBox ID="txtKeyWord" runat="server" Height="25px" EmptyMessage="Nhập từ khóa tìm kiếm" LabelCssClass="" Width="200px">
                                        <ClientEvents OnKeyPress="OnKeyPress" />
                                    </telerik:RadTextBox>
                                </td>
                                <td>
                                    <asp:Button ID="btnSearch" runat="server" CssClass="myButton" Text="Tìm kiếm"
                                        OnClick="btnSearch_Click" />
                                </td>
                                <td>
                                   <asp:Button ID="tbnExport" Width="100px" runat="server"  CssClass="myButton" Text="Export excel"
                                        OnClick="tbnExport_Click" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>

            <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All"></telerik:RadFormDecorator>

            <telerik:RadGrid ID="rdgBus" MasterTableView-InsertItemPageIndexAction="ShowItemOnFirstPage" runat="server" AllowPaging="True" AutoGenerateColumns="False" GridLines="None" OnDeleteCommand="rdGDriver_DeleteCommand" OnInsertCommand="rdGDriver_InsertCommand" OnItemDataBound="rdGDriver_ItemDataBound" OnNeedDataSource="rdGDriver_NeedDataSource" OnUpdateCommand="rdGDriver_UpdateCommand" PageSize="5" Skin="Office2010Blue">
                <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                <MasterTableView AllowSorting="True" CommandItemDisplay="Top" DataKeyNames="IDBus">
                    <Columns>
                        <telerik:GridTemplateColumn DataField="STT" HeaderText="STT" UniqueName="STT">
                            <ItemTemplate>
                                <asp:Label ID="lblSTT" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="RegistrationNumber" EditFormHeaderTextFormat="Số đăng ký xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số đăng ký xe" UniqueName="RegistrationNumber">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtRegistrationNumber" runat="server" Text='<%# Bind("RegistrationNumber") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblRegistrationNumber" Font-Bold="false" runat="server" Text='<%# Eval("RegistrationNumber") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn DataField="NumberMachine" EditFormHeaderTextFormat="Số máy:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số máy" UniqueName="NumberMachine">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNumberMachine" runat="server" Text='<%# Bind("NumberMachine") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNumberMachine" Font-Bold="false" runat="server" Text='<%# Eval("NumberMachine") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn DataField="NumberChassis" EditFormHeaderTextFormat="Số khung:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số khung" UniqueName="NumberChassis">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNumberChassis" runat="server" Text='<%# Bind("NumberChassis") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNumberChassis" Font-Bold="false" runat="server" Text='<%# Eval("NumberChassis") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>

                        <telerik:GridTemplateColumn DataField="Capacity" EditFormHeaderTextFormat="Số ghế:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Số ghế" UniqueName="Capacity">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtCapacity" runat="server" Text='<%# Bind("Capacity") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblCapacity" runat="server" Text='<%# Eval("Capacity") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="100px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="StatusBus" EditFormHeaderTextFormat="Tình trạng xe hiện tại:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Tình trạng xe hiện tại" UniqueName="StatusBus">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtStatusBus" runat="server" Text='<%# Bind("StatusBus") %>' Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblStatusBus" runat="server" Text='<%# Eval("StatusBus") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="150px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="StartDateUse" EditFormHeaderTextFormat="Ngày bắt đầu sử dụng xe:&lt;font color=red&gt;(*)&lt;/font&gt;" HeaderText="Ngày bắt đầu sử dụng xe" UniqueName="StartDateUse">
                            <EditItemTemplate>
                                <telerik:RadDatePicker Skin="Office2010Blue" Width="200px" ID="rdpStartDateUse" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("StartDateUse") %>'
                                    TabIndex="4">
                                    <DateInput ID="DateInput1" runat="server" DateFormat="yyyy-MM-dd" DisplayDateFormat="dd/MM/yyyy">
                                    </DateInput>
                                </telerik:RadDatePicker>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblStartDateUser" runat="server" Text='<%# Eval("StartDateUse") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="200px" />
                            <ItemStyle HorizontalAlign="Left" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Note" EditFormHeaderTextFormat="Ghi chú:" HeaderText="Ghi chú" UniqueName="Note">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtNote" runat="server" Text='<%# Bind("Note") %>' Rows="3" Width="300px"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblNote" runat="server" Text='<%# Eval("Note") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" Width="300px" />
                        </telerik:GridTemplateColumn>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../Images/Grid/Skins/Telerik/Edit.gif" EditText="Chỉnh sửa" InsertImageUrl="../Images/Grid/Skins/Telerik/Insert.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" UniqueName="Edit">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Bạn có chắc chắn muốn xóa không?" ImageUrl="../Images/Grid/Skins/Telerik/Delete.gif" ItemStyle-Height="20px" ItemStyle-Width="20px" Text="Xóa" UniqueName="Delete">
                            <ItemStyle CssClass="editcommand" />
                            <HeaderStyle Height="20px" HorizontalAlign="Left" Width="20px" />
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings CaptionDataField="STT" CaptionFormatString="Chỉnh sửa dữ liệu cho STT {0}">
                        <EditColumn ButtonType="PushButton" CancelText="Hủy bỏ" InsertText="Thêm mới" UniqueName="EditCommandColumn1" UpdateText="Cập nhật">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" CssClass="GridPager_Telerik" Mode="NextPrevNumericAndAdvanced" NextPageText="Next" PagerTextFormat="{4}|Displaying page {0} / {1},items {2} to {3} of {5}" PrevPageText="Previous" VerticalAlign="Middle" />
                    <CommandItemTemplate>
                        <table style="border: 0; width: 100%">
                            <tr>
                                <td style="text-align: left">
                                    <asp:LinkButton ID="lkbtnAddBusRides" runat="server" CommandName="InitInsert" Text="&lt;img style=&quot;border:0px&quot; alt=&quot;&quot; src=&quot;../Images/Grid/Skins/Telerik/AddRecord.gif&quot; /&gt; Thêm mới xe"></asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>
                </MasterTableView>
            </telerik:RadGrid>
            <telerik:RadInputManager runat="server" ID="RadInputManager1">
                <telerik:TextBoxSetting EmptyMessage="Vui lòng nhập dữ liệu.." ErrorMessage="Vui lòng nhập dữ liệu..">
                    <TargetControls>
                        <telerik:TargetInput ControlID="txtRegistrationNumber" />
                        <telerik:TargetInput ControlID="txtNumberMachine" />
                        <telerik:TargetInput ControlID="txtNumberChassis" />
                        <telerik:TargetInput ControlID="txtCapacity" />
                        <telerik:TargetInput ControlID="txtStatusBus" />
                    </TargetControls>
                    <Validation IsRequired="True" />
                </telerik:TextBoxSetting>
                <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" EmptyMessage="Vui lòng nhập dữ liệu..." Type="Number" DecimalDigits="0"
                    MaxValue="99999999" MinValue="0">
                    <TargetControls>
                        <telerik:TargetInput ControlID="txtCapacity" />
                    </TargetControls>
                </telerik:NumericTextBoxSetting>
                <telerik:DateInputSetting></telerik:DateInputSetting>
            </telerik:RadInputManager>
        </telerik:RadAjaxPanel>

        <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Transparency="30" BackColor="White"
            Width="967px">
            <asp:Image ID="Image1" runat="server" Style="margin-top: 150px" AlternateText="Loading"
                BorderWidth="0px" ImageUrl="../Images/ImageControl/loading.old.gif" />
        </telerik:RadAjaxLoadingPanel>
    </div>

</asp:Content>
